package edu.ynu.MyProject.controller;

import edu.ynu.MyProject.common.controller.LogicController;
import edu.ynu.MyProject.dao.ITokenDao;
import edu.ynu.MyProject.entity.Token;
import edu.ynu.MyProject.service.TokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api("获取Token")
@RestController
@RequestMapping("/token")
public class TokenController extends LogicController<TokenService, ITokenDao, Token, Long> {

    public TokenController(@Autowired TokenService tokenService) {
        super(tokenService);
    }

    @ApiOperation("获取访问传感器的token")
    @GetMapping("/sensor")
    public String getSensorToken() {
        return service.getSensorToken();
    }

    @ApiOperation("获取访问摄像机的token")
    @GetMapping("/camera")
    public String getCameraToken() {
        return service.getCameraToken();
    }
}
